package com.jiangsong.mq;


import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class MyMqSender {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    public void sendMsg(String msgBody) {
// 发送同步消息
        log.info("test sendMes begin, mes:{}", msgBody);
        SendResult sendResult = rocketMQTemplate.syncSend("TopicTest", msgBody);
        log.info("test sendMes,发送结果: {}", sendResult);
    }
}
